#include "headers.cpp"

vector<vector<int>> res;
vector<int> path;
void backtracking(int n, int k, int startIndex) {
	if (path.size() == k) {
		res.push_back(path);
		return;
	}
	int optimize = n - (k - path.size()) + 1;
	for (int i = startIndex; i <= optimize; i++) {
		path.push_back(i);           // deal
		backtracking(n, k, i + 1);   // recursion
		path.pop_back();             // backtrack
	}
}
vector<vector<int>> combine(int n, int k) {
	res.clear();
	path.clear();
	backtracking(n, k, 1);
	return res;
}
//---------------------------------------------------
